package com.autoai.animation.demo.customdialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.autoai.animation.demo.R;

/**
 * @author Wangjw
 * @date 2020-12-21
 * @brief
 */
public class QrCustomDialog extends Dialog {

    private static QrCustomDialog INSTANCE;

    public QrCustomDialog(@NonNull Context context) {
        super(context);
    }

    public QrCustomDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected QrCustomDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public static QrCustomDialog getInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = new QrCustomDialog(context, R.style.CustomDialog);
        }
        return INSTANCE;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lay_qr_login_dialog);
        this.getWindow().setGravity(Gravity.RIGHT);
        this.getWindow().setWindowAnimations(R.style.QrCustomDialogAnimation);
    }
}
